package com.xnew.manager.maintainPlan.controller;

import com.xnew.aes.LogParameter;
import com.xnew.manager.maintainPlan.entity.ElMaintainPlanDetails;
import com.xnew.manager.maintainPlan.service.ElMaintainPlanDetailsService;
import com.xnew.utils.ConvertEntityUtil;
import com.xnew.utils.DataInput;
import com.xnew.utils.DataOutput;
import com.xnew.utils.MybatisParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Description: 维保计划详情
 * @Author: Y70
 * @date 2022/10/24
 */
@RestController
@RequestMapping("/maintainPlanDetails")
public class ElMaintainPlanDetailsController {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Resource
    private ElMaintainPlanDetailsService elMaintainPlanDetailsService;

    /**
     * 维保计划详情列表
     * @param input
     * @param request
     * @return
     */
    @LogParameter(key = "", desc = "维保计划详情列表")
    @RequestMapping(value = "/queryMaintainDetailsList", method = RequestMethod.POST)
    public DataOutput queryMaintainDetailsList(@RequestBody DataInput input, HttpServletRequest request){
        DataOutput out = DataOutput.success();
        try{
            List<ElMaintainPlanDetails> elMaintainPlanDetails = elMaintainPlanDetailsService.queryMaintainDetailsList(input);
            out = MybatisParam.getOutput(ConvertEntityUtil.convertListData(elMaintainPlanDetails));
        }catch (Exception e){
            logger.error(e.getMessage(), e);
            out.setCode(-94001);
            out.setMsg("列表查询出错！");
        }
        return out;
    }

}
